from base import Yaml, Path
from page.home_page import HomePage


class PersonalCenterPage(HomePage):
    """个人中心"""
    __config = Yaml.get_config_as_dict(Path.get_actual_path_by_current_file(__file__, "personage.yaml"))[
        "PersonalCenterPage"]

    def click_home_page_icon(self):
        """
        点击首页
        :return:
        """
        self.driver.click(self.__config["HOME_PAGE_ICON"])

    def click_send_order_button(self):
        """
        点击下单寄件
        :return:
        """
        self.driver.click(self.__config["SEND_ORDER_BUTTON"])

    def click_waybill_management(self):
        """
        点击运单管理
        :return:
        """
        self.driver.click(self.__config["WAYBILL_MANAGEMENT"])

    def click_self_serve(self):
        """
        点击自助服务
        :return:
        """
        self.driver.click(self.__config["SELF_SERVE"])

    def click_pickup_location(self):
        """
        点击取货定位
        :return:
        """
        self.driver.click(self.__config["PICKUP_LOCATION"])

    def click_waybill_tracking_input_box(self):
        """
        点击运单追踪
        :return:
        """
        self.driver.click(self.__config["WAYBILL_TRACKING_INPUT_BOX"])

    def click_network_query(self):
        """
        点击网点查询
        :return:
        """
        self.driver.click(self.__config["NETWORK_QUERY"])

    def click_limitation_of_freight(self):
        """
        点击时效运费查询
        :return:
        """
        self.driver.click(self.__config["LIMITATION_OF_FREIGHT"])

    def click_bill_management(self):
        """
        点击帐单管理
        :return:
        """
        self.driver.click(self.__config["BILL_MANAGEMENT"])

    def click_the_customer_deposit(self):
        """
        点击客户预存
        :return:
        """
        self.driver.click(self.__config["THE_CUSTOMER_DEPOSIT"])

    def click_CLIENT_RECONCILIATION(self):
        """
        点击客户对账
        :return:
        """
        self.driver.click(self.__config["CLIENT_RECONCILIATION"])

    def click_electronic_invoice(self):
        """
        点击电子发票
        :return:
        """
        self.driver.click(self.__config["ELECTRONIC_INVOICE"])

    def click_customer_quotation(self):
        """
        点击客户报价
        :return:
        """
        self.driver.click(self.__config["CUSTOMER_QUOTATION"])

    def click_address_book(self):
        """
        点击地址薄
        :return:
        """
        self.driver.click(self.__config["ADDRESS_BOOK"])

    def click_personal_setting(self):
        """
        点击个人设置
        :return:
        """
        self.driver.click(self.__config["PERSONAL_SETTING"])

    def click_personal_information(self):
        """
        点击个人信息
        :return:
        """
        self.driver.click(self.__config["PERSONAL_INFORMATION"])

    def click_print_the_configuration(self):
        """
        点击打印配置
        :return:
        """
        self.driver.click(self.__config["PRINT_THE_CONFIGURATION"])

    def click_the_client_code(self):
        """
        点击客户编码
        :return:
        """
        self.driver.click(self.__config["THE_CLIENT_CODE"])

    def click_password(self):
        """
        点击密码设置
        :return:
        """
        self.driver.click(self.__config["PASSWORD"])

    def get_order_text(self):
        """
        获取下单成功文本
        :return:
        """
        self.driver.forced_wait(1)
        a = self.driver.get_text(selector='x, //*[@id="app"]/div/div[1]/div/div[2]/div/div/p[1]')
        return a
